package com.ruoyi.mdm.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mdm.mapper.SkuProductMasterSubMapper;
import com.ruoyi.mdm.domain.SkuProductMasterSub;
import com.ruoyi.mdm.service.ISkuProductMasterSubService;

/**
 * spu子Service业务层处理
 *
 * @author shiseido
 * @date 2025-03-01
 */
@Service
public class SkuProductMasterSubServiceImpl implements ISkuProductMasterSubService {
    @Autowired
    private SkuProductMasterSubMapper skuProductMasterSubMapper;

    /**
     * 查询spu子
     *
     * @param id spu子主键
     * @return spu子
     */
    @Override
    public SkuProductMasterSub selectSkuProductMasterSubById(Long id) {
        return skuProductMasterSubMapper.selectSkuProductMasterSubById(id);
    }

    /**
     * 查询spu子列表
     *
     * @param skuProductMasterSub spu子
     * @return spu子
     */
    @Override
    public List<SkuProductMasterSub> selectSkuProductMasterSubList(SkuProductMasterSub skuProductMasterSub) {
        return skuProductMasterSubMapper.selectSkuProductMasterSubList(skuProductMasterSub);
    }

    /**
     * 新增spu子
     *
     * @param skuProductMasterSub spu子
     * @return 结果
     */
    @Override
    public int insertSkuProductMasterSub(SkuProductMasterSub skuProductMasterSub) {
        skuProductMasterSub.setCreateTime(DateUtils.getNowDate());
        return skuProductMasterSubMapper.insertSkuProductMasterSub(skuProductMasterSub);
    }

    /**
     * 修改spu子
     *
     * @param skuProductMasterSub spu子
     * @return 结果
     */
    @Override
    public int updateSkuProductMasterSub(SkuProductMasterSub skuProductMasterSub) {
        skuProductMasterSub.setUpdateTime(DateUtils.getNowDate());
        return skuProductMasterSubMapper.updateSkuProductMasterSub(skuProductMasterSub);
    }

    /**
     * 批量删除spu子
     *
     * @param ids 需要删除的spu子主键
     * @return 结果
     */
    @Override
    public int deleteSkuProductMasterSubByIds(Long[] ids) {
        return skuProductMasterSubMapper.deleteSkuProductMasterSubByIds(ids);
    }

    /**
     * 删除spu子信息
     *
     * @param id spu子主键
     * @return 结果
     */
    @Override
    public int deleteSkuProductMasterSubById(Long id) {
        return skuProductMasterSubMapper.deleteSkuProductMasterSubById(id);
    }
}
